Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vscode): show inline diff of characters #3709

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

zhanba
Copy link
Contributor

@zhanba zhanba commented Jan 16, 2025

@zhanba zhanba force-pushed the feat-inline-char-diff branch from 3bd2214 to eabbc1e Compare January 16, 2025 05:50
@wsxiaoys wsxiaoys changed the title feat: show inline diff of characters feat(vscode): show inline diff of characters Jan 17, 2025
@icycodes
Copy link
Member

Hi @zhanba
Thank you for the PR.

I created a simple snippet to test the diff decoration, but it doesn't seem to handle this case properly. Could you please take a look?
Screenshot from 2025-01-17 18-32-13

@zhanba zhanba force-pushed the feat-inline-char-diff branch from eabbc1e to 491c8bb Compare January 17, 2025 13:07
@zhanba
Copy link
Contributor Author

zhanba commented Jan 17, 2025

Hi @zhanba Thank you for the PR.

I created a simple snippet to test the diff decoration, but it doesn't seem to handle this case properly. Could you please take a look? Screenshot from 2025-01-17 18-32-13

Fix some decoration calculation error. For this case, we can only get below result due to limitation of the diff package.
image

jsdiff playground:
image

The monaco diff editor show a better result, I will check if we can use the monaco diff algorithm.
image

@zhanba zhanba force-pushed the feat-inline-char-diff branch 2 times, most recently from 42975cc to 337475b Compare January 20, 2025 02:18
@wsxiaoys wsxiaoys requested a review from icycodes January 20, 2025 02:50
@zhanba zhanba force-pushed the feat-inline-char-diff branch from 337475b to ae9d721 Compare February 8, 2025 04:05
@zhanba
Copy link
Contributor Author

zhanba commented Feb 8, 2025

@icycodes @wsxiaoys I have extract the VSCode diff algorithm to this package codiff, it provide much better diff result. I believe we can use it in this pr.

image

@zhanba
Copy link
Contributor Author

zhanba commented Feb 8, 2025

use codiff in tabby:

image

image

@zhanba zhanba force-pushed the feat-inline-char-diff branch from bf4a411 to 9e47623 Compare February 8, 2025 09:00
@icycodes
Copy link
Member

icycodes commented Feb 8, 2025

use codiff in tabby:

image

image

Looks great!
I have left some comments, please take a look.

clients/vscode/src/lsp/CodeLensMiddleware.ts Outdated Show resolved Hide resolved
clients/tabby-agent/src/codeLens.ts Outdated Show resolved Hide resolved
clients/tabby-agent/src/utils/diff.ts Outdated Show resolved Hide resolved
clients/tabby-agent/src/utils/diff.ts Outdated Show resolved Hide resolved
clients/tabby-agent/src/utils/diff.ts Outdated Show resolved Hide resolved
@zhanba zhanba force-pushed the feat-inline-char-diff branch from 9e47623 to 62d86aa Compare February 10, 2025 02:00
@zhanba
Copy link
Contributor Author

zhanba commented Feb 11, 2025

Looks great! I have left some comments, please take a look.

Fixed

@wsxiaoys wsxiaoys merged commit 6d1e2ae into TabbyML:main Feb 11, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants